"use strict";
var MySnake;
(function (MySnake) {
    //播放状态
    var PalyState;
    (function (PalyState) {
        PalyState[PalyState["Play"] = 0] = "Play";
        PalyState[PalyState["Pause"] = 1] = "Pause";
        PalyState[PalyState["Stop"] = 2] = "Stop";
        PalyState[PalyState["Replay"] = 3] = "Replay";
    })(PalyState = MySnake.PalyState || (MySnake.PalyState = {}));
    //添加游戏背景音乐
    var Music = /** @class */ (function () {
        function Music() {
        }
        /**
         * 游戏背景音乐操作
         * @param audio - 多媒体控件
         * @param ps - 播放状态
         */
        Music.GoGimes = function (audio, ps) {
            switch (ps) {
                case PalyState.Play:
                    this.Play(audio);
                    break;
                case PalyState.Pause:
                    this.Pause(audio);
                    break;
                case PalyState.Stop:
                    this.Stop(audio);
                    break;
                case PalyState.Replay:
                    this.Replay(audio);
                    break;
            }
        };
        /**
         * 播放(继续播放)
         * @param audio
         */
        Music.Play = function (audio) {
            audio.play();
        };
        /**
         * 暂停
         * @param audio
         */
        Music.Pause = function (audio) {
            audio.pause();
        };
        /**
         * 停止
         * @param audio
         */
        Music.Stop = function (audio) {
            audio.pause();
            audio.currentTime = 0; //设置或返回音频/视频中的当前播放位置（以秒计）
        };
        /**
         * 重新播放
         * @param audio
         */
        Music.Replay = function (audio) {
            audio.currentTime = 0;
            audio.play();
        };
        /**
         * 声音控制
         * @param audio
         * @param valnum
         */
        Music.SoundControl = function (audio, valnum) {
            audio.volume = valnum; //设置或返回音频/视频的音量
        };
        return Music;
    }());
    MySnake.Music = Music;
})(MySnake || (MySnake = {}));
